﻿@model WriterStars.Models.ViewModels.BookViewModel
@using Microsoft.AspNet.Identity
@{
    string currentUserId = User.Identity.GetUserId();
    int contestId = ViewBag.ContestId ?? 0;    
}

<div class="book-wrapper">
    <book class="box-container">
        <header class="box-header">
            <div class="category-holder" style="background-color:#@Model.Color">
                @Model.CategoryName
            </div>
            <h4 class="title">
                @if (currentUserId == Model.AuthorId)
                {
                    <a href="/Book/Edit/@Model.Id">
                        @Model.Title
                    </a>
                }
                else
                {
                    <a href="/book/read/@Model.Id">
                        @Model.Title
                    </a>
                }
            </h4>
            <img class="img-responsive" src="@Model.CategoryImage" />

        </header>
        <input type="hidden" class="book-content" data-index="@Model.Id" data-content="@Model.LongContent" />
        <p class="book-holder-@Model.Id">
        </p>
        <footer>
            @Model.Date.ToString("MMM dd, yyyy")
            @if (contestId != 0)
            {
                <span class="pull-right wars-check" data-book-id="@Model.Id" data-book-title="@Model.Title">
                    <i class="fa fa-check fa-lg"></i>
                </span>
            }
            <span class="pull-right">
                @Model.Likes likes
            </span>
        </footer>
    </book>
</div>

